INTERFACE 1000,100
VSTVAR 0,.2,"VOLUME","",0,1,1
// Maximum modulation, with velocity = 127
TOOLTIP "Maximum modulation",1
VSTVAR 1,2,"MODULATION","",0,15,1
// Decay of the modulation: time that the waveform takes to become pure sinusoid
VSTVAR 2,20,"MODDCY","",1,300,0
// Second decay of the sound envelope
VSTVAR 3,90,"AMPDCY","",3,300,0
// Sustain between decays
VSTVAR 4,.5,"SUSTAIN1","",0,1,1
// Final sustain
VSTVAR 5,.02,"SUSTAIN2","",0,1,1
// Frequency multiplier of the modulator
VSTVAR 6,.4975,"FREQ.MUL","",.48,.52,1
// Release
VSTVAR 7,1,"RELEASE","",.1,30,0
TOOLTIP "Carrier Type: Sine, Square, Asymmetric Triangle, Smoothed Sawtooth, Triangle", 8
VSTVAR 8,0,"Carrier","",0,4,4,"Sine","Square","Triangle Slope","Sawtooth Smooth","Triangle"
TOOLTIP "Carrier distortion: Exponent (Sine), PWM (Square), Slope (Asymmetric Triangle), Smoothing (Smoothed Sawtooth), Exponent(Triangle)", 9
VSTVAR 9,10,"Carrier Dist","%",0,100,1
TOOLTIP "Modulator Type: Sine, Square, Asymmetric Triangle, Smoothed Sawtooth, Triangle, Noise", 10
VSTVAR 10,0,"Modulator","",0,5,4,"Sine","Square","Triangle Slope","Sawtooth Smooth","Triangle","Noise"
TOOLTIP "Modulator distortion: Exponent (Sine), PWM (Square), Slope (Asymmetric Triangle), Smoothing (Smoothed Sawtooth), Exponent(Triangle), N/A (Noise)", 11
VSTVAR 11,10,"Mod Dist","%",0,100,1

VSTVARS 12

//debug 1
LAYER
// Modulator = <maximum modulation> * <velocity> * <envelope> * <sinusoid>
F=MCC611
EXECIF 610,0,0 F=F*.1
EXECIF 610,1,1 F=F*.01
EXECIF 610,2,2 F=F*.01
EXECIF 610,3,3 F=102-F
EXECIF 610,4,4 F=F*.1


Modulator = OSCG("mkk000S", MCC610, F, MCC(601), MCC(606), .1, MCC(602), 0,MCC(607))
//En = MCC601 * ENV0(.1, MCC(602), 0,MCC(607))

E=MCC609
EXECIF 608,0,0 E=E*.1
EXECIF 608,1,1 E=E*.01
EXECIF 608,2,2 E=E*.01
EXECIF 608,3,3 E=102-E
EXECIF 608,4,4 E=E*.1
// Output = <volume> * GAIN * <modulated sinusoid>
OUT=OSCG("mkf00PD", MCC608, E, MCC(600), Modulator, .1,.1,MCC(604),MCC(603),MCC(605),MCC(607))
//OUT=OSCG("mkf00GD", MCC608, E, MCC600, En, MCC606, MCC610, F, .1,.1,MCC(604),MCC(603),MCC(605),MCC(607))
